package contegor.scire.core.queries;

import contegor.scire.core.Connectable;
import contegor.scire.core.Version;

/**
 * Login <code>not</code> {@link Condition} of other.
 *
 * @version $Revision: 1.3 $
 * @author  Héctor Cirbián Pousa ($Author: hector $)
 */
@Version("$Id: Not.java,v 1.3 2010-02-01 10:55:41 hector Exp $")
public class Not<C extends Connectable> extends Condition<C> {
  private static final long serialVersionUID = 844452333516794436L;

  private Condition<C> nested;

  /**
   * Creates a logic <code>not</code> {@link Condition} of the one given.
   */
  public Not(Condition<C> condition) {
    super();
    this.nested = condition;
  }

  /* (non-Javadoc)
   * @see contegor.scire.core.queries.Condition#eval(contegor.scire.core.Connectable)
   */
  @Override
  public boolean eval(C connectable) {
    return !nested.eval(connectable);
  }

  @Override
  public Not<C> clone() {
    return new Not<C>(this.nested.clone()); 
  }
}
